import request from '@/utils/request'

// 获取停车场列表
export function getParkingLots(params) {
  return request({
    url: '/api/parking/lots',
    method: 'get',
    params
  })
}

// 获取停车场详情
export function getParkingLot(id) {
  return request({
    url: `/api/parking/lots/${id}`,
    method: 'get'
  })
}

// 开始停车
export function startParking(parkingLotId) {
  return request({
    url: '/api/parking/start',
    method: 'post',
    data: {
      parkingLotId
    }
  })
}

// 结束停车
export function endParking(parkingLotId) {
  return request({
    url: '/api/parking/end',
    method: 'post',
    data: {
      parkingLotId
    }
  })
}

// 获取用户停车记录
export function getUserParkingRecords(params) {
  return request({
    url: '/api/parking/user/records',
    method: 'get',
    params
  })
}

// 获取停车记录详情
export function getParkingRecord(id) {
  return request({
    url: `/api/parking/records/${id}`,
    method: 'get'
  })
}

// 获取所需信用分
export function getRequiredCreditScore() {
  return request({
    url: '/api/parking/required-credit-score',
    method: 'get'
  })
}

// 计算停车费用
export function calculateParkingFee(recordId) {
  return request({
    url: `/api/parking/fee/${recordId}`,
    method: 'get'
  })
} 